From 6aef0ff045fe46bac58d3fca8b10fa688fad6e47 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 23 Jul 2015 08:59:05 +0100 Subject: [PATCH] xl: free pid string in do_daemonize Pid is a null terminated string allocated by asprintf. It should be freed after use. Also fixed a coding style problem while I was there. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- tools/libxl/xl_cmdimpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index a578e3b6e2..9027acba81 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -524,10 +524,12 @@ static int do_daemonize(char *name, const char *pidfile) exit(1); } - if ( close(fd) < 0 ) { + if (close(fd) < 0) { perror("Closing pidfile"); exit(1); } + + free(pid); } out: -- 2.30.2